package com.xieyingwangluo.yxpart.runner;

import com.xieyingwangluo.yxpart.utils.SpringContextHandler;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

@Component
public class SystemStartRunner implements ApplicationContextAware, Ordered {

    @Override
    public int getOrder() {
        // 启动顺序值
        return 10;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        // 将applicationContext 注入到 SpringContextHandler中
        SpringContextHandler.setApplicationContext(applicationContext);
    }
}
